home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / VOL_400 / 446_01 / DOC / DPBASICS / ODE / TIMELOOP.C < prev   
Encoding:
C/C++ Source or Header  |  1996-04-18  |  307 b   |  13 lines

  1. #include <ode.h>
  2.  
  3. void timeLoop (ODESolver* solver, Vec(real)& y, real dt, real t_end)
  4. {
  5.   Os ofile ("FILE=ppp");   // write results to file "ppp"
  6.   real t = 0;
  7.   while (t < t_end)
  8.     {
  9.       solver->advance (y, t, dt);  // update y and t (and possibly dt)
  10.       ofile << t << " " << y(1) << '\n';
  11.     }
  12. }
  13.